package main

import (
	"fmt"
	"gopl/ch6/geometry"
	"gopl/ch6/intset"
)

func main() {
	p := geometry.Point{1, 2}
	q := geometry.Point{4, 6}
	fmt.Println(geometry.Distance(p, q))
	fmt.Println(p.Distance(q))

	perim := geometry.Path{
		{1, 1},
		{5, 1},
		{5, 4},
		{1, 1},
	}
	fmt.Println(perim.Distance())

	r := &geometry.Point{1, 2}
	r.ScaleBy(2)
	fmt.Println(*r)

	s := geometry.Point{1, 2}
	pptr := &s
	pptr.ScaleBy(2)
	fmt.Println(s)
	fmt.Printf("%T\t%T\n", r, pptr)

	var x, y intset.IntSet
	fmt.Println(x.String())
	x.Add(1)
	x.Add(144)
	x.Add(9)
	fmt.Println(x.String())

	y.Add(9)
	y.Add(42)
	fmt.Println(y.String())
	x.UnionWith(&y)
	fmt.Println(x.String())
	fmt.Println(x.Has(9), x.Has(123))

	fmt.Println(&x)
	fmt.Println(x.String())
	x.Clear()
	fmt.Println(x.String())

	fmt.Println(x)
}
